package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;

/**
 * Create By IntelliJ IDEA
 *
 * @Author: jsonor
 * @Create-Time: 2017/9/21 8:36
 * @Description: 例子演示 day05
 */
public class HelloWorldServlet extends HttpServlet {

  private static Logger logger = Logger.getLogger(HelloWorldServlet.class);

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    // 请求的类型
    logger.debug("get method : " + req.getMethod());

    resp.getWriter().write("hello world, i get your message from get method");
  }

  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    resp.getWriter().write("hello world, i get your message from post method");
  }
}
